/**
 * Copyright (C) 2008 Mathieu Carbou <mathieu.carbou@gmail.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mycila.maven.ui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 * @author Mathieu Carbou - mathieu.carbou(at)gmail.com
 */
final class MavenDeployerGui {
    public JPanel formPanel;
    public JPanel bottomPanel;
    public JPanel topPanel;
    public JButton deploy;
    public JTextField groupId;
    public JTextField artifactId;
    public JComboBox classifier;
    public JTextField version;
    public JComboBox packaging;
    public JTextField repositoryURL;
    public JButton repositoryBrowser;
    public JTextField artifactFile;
    public JButton artifactBrowser;
    public JTextArea console;
    public JButton cancel;
    public JButton clear;
    public JTextField description;
    public JTextField repositoryID;
    public JButton loadPOM;
    public JCheckBox cbDeployPOM;
    public JTextField mavenBin;
    public JButton btnInstall;
    private GridBagConstraints gbc_1;
    private GridBagConstraints gbc_2;
    private GridBagConstraints gbc_3;
    private GridBagConstraints gbc_4;
    private GridBagConstraints gbc_5;
    private GridBagConstraints gbc_6;
    private GridBagConstraints gbc_7;
    private GridBagConstraints gbc_8;
    private GridBagConstraints gbc_9;
    private GridBagConstraints gbc_10;
    private GridBagConstraints gbc_11;
    private GridBagConstraints gbc_12;
    private GridBagConstraints gbc_13;
    private GridBagConstraints gbc_14;
    private GridBagConstraints gbc_15;
    private JLabel lblGav;
    public JTextArea textGAV;

    /**
     * @wbp.parser.entryPoint
     */
    private void createUIComponents() {
        topPanel = new JPanel();
        clear = new JButton();
        loadPOM = new JButton();
    }

    {
        // GUI initializer generated by IntelliJ IDEA GUI Designer
        // >>> IMPORTANT!! <<<
        // DO NOT EDIT OR ADD ANY CODE HERE!
        $$$setupUI$$$();
    }

    /**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     * @noinspection ALL
     */
    private void $$$setupUI$$$() {
        createUIComponents();
        formPanel = new JPanel();
        formPanel.setLayout(new BorderLayout(0, 0));
        formPanel.setPreferredSize(new Dimension(557, 492));
        GridBagLayout gbl_topPanel = new GridBagLayout();
        gbl_topPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
        gbl_topPanel.columnWeights = new double[] { 0.0, 1.0, 0.0 };
        topPanel.setLayout(gbl_topPanel);
        formPanel.add(topPanel, BorderLayout.NORTH);
        final JLabel label1 = new JLabel();
        label1.setFont(new Font(label1.getFont().getName(), Font.BOLD, label1.getFont().getSize()));
        label1.setForeground(new Color(-65536));
        label1.setText("GroupId");
        GridBagConstraints gbc;

        lblGav = new JLabel("GAV");
        GridBagConstraints gbc_lblGav = new GridBagConstraints();
        gbc_lblGav.anchor = GridBagConstraints.WEST;
        gbc_lblGav.insets = new Insets(0, 5, 5, 5);
        gbc_lblGav.gridx = 0;
        gbc_lblGav.gridy = 0;
        gbc_lblGav.gridwidth = 2;
        gbc_lblGav.weightx = 0.5;
        gbc_lblGav.anchor = GridBagConstraints.WEST;
        gbc_lblGav.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(lblGav, gbc_lblGav);

        final JScrollPane scrollPane2 = new JScrollPane();
        textGAV = new JTextArea();
        textGAV.setFont(new Font("Courier New", textGAV.getFont().getStyle(), 11));
        scrollPane2.setViewportView(textGAV);

        textGAV.setRows(5);
        GridBagConstraints gbc_textGAV = new GridBagConstraints();
        gbc_textGAV.gridwidth = 2;
        gbc_textGAV.insets = new Insets(0, 0, 5, 0);
        gbc_textGAV.fill = GridBagConstraints.BOTH;
        gbc_textGAV.gridx = 1;
        gbc_textGAV.gridy = 0;
        topPanel.add(scrollPane2, gbc_textGAV);
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 1;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 5, 5);
        topPanel.add(label1, gbc);
        groupId = new JTextField();
        groupId.setText("");
        groupId.setToolTipText("GroupId of the artifact to be deployed.");
        gbc_1 = new GridBagConstraints();
        gbc_1.insets = new Insets(0, 0, 5, 0);
        gbc_1.gridx = 1;
        gbc_1.gridy = 1;
        gbc_1.gridwidth = 2;
        gbc_1.weightx = 0.5;
        gbc_1.anchor = GridBagConstraints.WEST;
        gbc_1.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(groupId, gbc_1);
        final JLabel label2 = new JLabel();
        label2.setFont(new Font(label2.getFont().getName(), Font.BOLD, label2.getFont().getSize()));
        label2.setForeground(Color.red);
        label2.setText("ArtifactId");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 2;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 5, 5);
        topPanel.add(label2, gbc);
        artifactId = new JTextField();
        artifactId.setText("");
        artifactId.setToolTipText("ArtifactId of the artifact to be deployed.");
        gbc_2 = new GridBagConstraints();
        gbc_2.insets = new Insets(0, 0, 5, 0);
        gbc_2.gridx = 1;
        gbc_2.gridy = 2;
        gbc_2.gridwidth = 2;
        gbc_2.weightx = 0.5;
        gbc_2.anchor = GridBagConstraints.WEST;
        gbc_2.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(artifactId, gbc_2);
        final JLabel label3 = new JLabel();
        label3.setFont(new Font(label3.getFont().getName(), Font.BOLD, label3.getFont().getSize()));
        label3.setForeground(Color.red);
        label3.setText("Version");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 4;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 5, 5);
        topPanel.add(label3, gbc);
        version = new JTextField();
        version.setText("");
        version.setToolTipText("Version of the artifact to be deployed.");
        gbc_3 = new GridBagConstraints();
        gbc_3.insets = new Insets(0, 0, 5, 0);
        gbc_3.gridx = 1;
        gbc_3.gridy = 4;
        gbc_3.gridwidth = 2;
        gbc_3.weightx = 0.5;
        gbc_3.anchor = GridBagConstraints.WEST;
        gbc_3.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(version, gbc_3);
        final JLabel label4 = new JLabel();
        label4.setFont(new Font(label4.getFont().getName(), Font.BOLD, label4.getFont().getSize()));
        label4.setForeground(Color.red);
        label4.setText("Repository (folder or URL)");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 9;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 5, 5);
        topPanel.add(label4, gbc);
        repositoryURL = new JTextField();
        repositoryURL.setEditable(true);
        repositoryURL
                .setFont(new Font(repositoryURL.getFont().getName(), Font.PLAIN, repositoryURL.getFont().getSize()));
        repositoryURL
                .setToolTipText("URL where the artifact will be deployed.\nExample: file://C:\\m2-repo, scp://host.com/path/to/repo, dav:https://mycompany.com/repo ) ");
        gbc_4 = new GridBagConstraints();
        gbc_4.insets = new Insets(0, 0, 5, 5);
        gbc_4.gridx = 1;
        gbc_4.gridy = 9;
        gbc_4.weightx = 0.5;
        gbc_4.anchor = GridBagConstraints.WEST;
        gbc_4.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(repositoryURL, gbc_4);
        repositoryBrowser = new JButton();
        repositoryBrowser.setFont(new Font(repositoryBrowser.getFont().getName(), Font.BOLD, repositoryBrowser
                .getFont().getSize()));
        repositoryBrowser.setPreferredSize(new Dimension(80, 20));
        repositoryBrowser.setText("Browse");
        gbc_5 = new GridBagConstraints();
        gbc_5.insets = new Insets(0, 0, 5, 0);
        gbc_5.gridx = 2;
        gbc_5.gridy = 9;
        gbc_5.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(repositoryBrowser, gbc_5);
        artifactFile = new JTextField();
        artifactFile.setText("");
        artifactFile.setToolTipText("File to be deployed. ");
        gbc_6 = new GridBagConstraints();
        gbc_6.insets = new Insets(0, 0, 5, 5);
        gbc_6.gridx = 1;
        gbc_6.gridy = 8;
        gbc_6.anchor = GridBagConstraints.WEST;
        gbc_6.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(artifactFile, gbc_6);
        final JLabel label5 = new JLabel();
        label5.setFont(new Font(label5.getFont().getName(), Font.BOLD, label5.getFont().getSize()));
        label5.setForeground(Color.red);
        label5.setText("Artifact file");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 8;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 5, 5);
        topPanel.add(label5, gbc);
        artifactBrowser = new JButton();
        artifactBrowser.setFont(new Font(artifactBrowser.getFont().getName(), Font.BOLD, artifactBrowser.getFont()
                .getSize()));
        artifactBrowser.setPreferredSize(new Dimension(80, 20));
        artifactBrowser.setText("Browse");
        gbc_7 = new GridBagConstraints();
        gbc_7.insets = new Insets(0, 0, 5, 0);
        gbc_7.gridx = 2;
        gbc_7.gridy = 8;
        gbc_7.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(artifactBrowser, gbc_7);
        final JLabel label6 = new JLabel();
        label6.setFont(new Font(label6.getFont().getName(), Font.BOLD, label6.getFont().getSize()));
        label6.setRequestFocusEnabled(false);
        label6.setText("Repository ID");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 10;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 5, 5);
        topPanel.add(label6, gbc);
        repositoryID = new JTextField();
        repositoryID.setDoubleBuffered(false);
        repositoryID.setText("");
        repositoryID
                .setToolTipText("Server Id to map on the <id> under <server> section of settings.xml In most cases, this parameter will be required for authentication.");
        gbc_8 = new GridBagConstraints();
        gbc_8.insets = new Insets(0, 0, 5, 0);
        gbc_8.gridx = 1;
        gbc_8.gridy = 10;
        gbc_8.gridwidth = 2;
        gbc_8.weightx = 0.5;
        gbc_8.anchor = GridBagConstraints.WEST;
        gbc_8.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(repositoryID, gbc_8);
        packaging = new JComboBox();
        packaging.setEditable(true);
        packaging.setFont(new Font(packaging.getFont().getName(), Font.PLAIN, packaging.getFont().getSize()));
        final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
        defaultComboBoxModel1.addElement("jar");
        defaultComboBoxModel1.addElement("war");
        defaultComboBoxModel1.addElement("zip");
        defaultComboBoxModel1.addElement("pom");
        packaging.setModel(defaultComboBoxModel1);
        packaging.setPreferredSize(new Dimension(94, 20));
        packaging.setToolTipText("Type of the artifact to be deployed.");
        packaging.setVerifyInputWhenFocusTarget(false);
        gbc_9 = new GridBagConstraints();
        gbc_9.insets = new Insets(0, 0, 5, 0);
        gbc_9.gridx = 1;
        gbc_9.gridy = 5;
        gbc_9.gridwidth = 2;
        gbc_9.weightx = 0.5;
        gbc_9.anchor = GridBagConstraints.WEST;
        gbc_9.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(packaging, gbc_9);
        final JLabel label7 = new JLabel();
        label7.setFont(new Font(label7.getFont().getName(), Font.BOLD, label7.getFont().getSize()));
        label7.setForeground(Color.red);
        label7.setText("Packaging");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 5;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 5, 5);
        topPanel.add(label7, gbc);
        final JLabel label8 = new JLabel();
        label8.setFont(new Font(label8.getFont().getName(), Font.BOLD, label8.getFont().getSize()));
        label8.setRequestFocusEnabled(false);
        label8.setText("Artifact description");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 6;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 5, 5);
        topPanel.add(label8, gbc);
        description = new JTextField();
        description.setEditable(true);
        description.setFont(new Font(description.getFont().getName(), Font.PLAIN, description.getFont().getSize()));
        description.setToolTipText("Description passed to a generated POM file");
        gbc_10 = new GridBagConstraints();
        gbc_10.insets = new Insets(0, 0, 5, 0);
        gbc_10.gridx = 1;
        gbc_10.gridy = 6;
        gbc_10.gridwidth = 2;
        gbc_10.weightx = 0.5;
        gbc_10.anchor = GridBagConstraints.WEST;
        gbc_10.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(description, gbc_10);
        final JLabel label9 = new JLabel();
        label9.setFont(new Font(label9.getFont().getName(), Font.BOLD, label9.getFont().getSize()));
        label9.setRequestFocusEnabled(false);
        label9.setText("Classifier");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 3;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 5, 5);
        topPanel.add(label9, gbc);
        classifier = new JComboBox();
        classifier.setEditable(true);
        classifier.setFont(new Font(classifier.getFont().getName(), Font.PLAIN, classifier.getFont().getSize()));
        final DefaultComboBoxModel defaultComboBoxModel2 = new DefaultComboBoxModel();
        defaultComboBoxModel2.addElement("");
        defaultComboBoxModel2.addElement("sources");
        defaultComboBoxModel2.addElement("javadoc");
        classifier.setModel(defaultComboBoxModel2);
        classifier.setPreferredSize(new Dimension(94, 20));
        classifier.setToolTipText("Add classifier to the artifact ");
        gbc_11 = new GridBagConstraints();
        gbc_11.insets = new Insets(0, 0, 5, 0);
        gbc_11.gridx = 1;
        gbc_11.gridy = 3;
        gbc_11.gridwidth = 2;
        gbc_11.weightx = 0.5;
        gbc_11.anchor = GridBagConstraints.WEST;
        gbc_11.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(classifier, gbc_11);
        final JPanel spacer1 = new JPanel();
        gbc_12 = new GridBagConstraints();
        gbc_12.insets = new Insets(0, 0, 5, 5);
        gbc_12.gridx = 0;
        gbc_12.gridy = 7;
        gbc_12.fill = GridBagConstraints.VERTICAL;
        topPanel.add(spacer1, gbc_12);
        final JPanel spacer2 = new JPanel();
        gbc_13 = new GridBagConstraints();
        gbc_13.insets = new Insets(0, 0, 5, 5);
        gbc_13.gridx = 1;
        gbc_13.gridy = 7;
        gbc_13.fill = GridBagConstraints.VERTICAL;
        topPanel.add(spacer2, gbc_13);
        final JPanel spacer3 = new JPanel();
        gbc_14 = new GridBagConstraints();
        gbc_14.insets = new Insets(0, 0, 5, 5);
        gbc_14.gridx = 0;
        gbc_14.gridy = 11;
        gbc_14.fill = GridBagConstraints.VERTICAL;
        topPanel.add(spacer3, gbc_14);
        final JPanel spacer4 = new JPanel();
        gbc_15 = new GridBagConstraints();
        gbc_15.insets = new Insets(0, 0, 5, 5);
        gbc_15.gridx = 1;
        gbc_15.gridy = 11;
        gbc_15.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(spacer4, gbc_15);
        mavenBin = new JTextField();
        mavenBin.setDoubleBuffered(false);
        mavenBin.setText("");
        mavenBin.setToolTipText("Complete path to Maven executable ");
        gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 12;
        gbc.gridwidth = 2;
        gbc.weightx = 0.5;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        topPanel.add(mavenBin, gbc);
        final JLabel label10 = new JLabel();
        label10.setFont(new Font(label10.getFont().getName(), Font.BOLD, label10.getFont().getSize()));
        label10.setForeground(Color.red);
        label10.setRequestFocusEnabled(false);
        label10.setText("Maven executable");
        gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridy = 12;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 5, 0, 5);
        topPanel.add(label10, gbc);
        final JScrollPane scrollPane1 = new JScrollPane();
        formPanel.add(scrollPane1, BorderLayout.CENTER);
        console = new JTextArea();
        console.setFont(new Font("Courier New", console.getFont().getStyle(), 11));
        scrollPane1.setViewportView(console);
        final JPanel panel1 = new JPanel();
        panel1.setLayout(new BorderLayout(0, 0));
        formPanel.add(panel1, BorderLayout.SOUTH);
        bottomPanel = new JPanel();
        bottomPanel.setLayout(new FlowLayout(FlowLayout.RIGHT, 1, 1));
        panel1.add(bottomPanel, BorderLayout.EAST);
        clear.setFont(new Font(clear.getFont().getName(), Font.BOLD, clear.getFont().getSize()));
        clear.setText("Clear");
        bottomPanel.add(clear);

        btnInstall = new JButton("Install");
        bottomPanel.add(btnInstall);
        deploy = new JButton();
        deploy.setFont(new Font(deploy.getFont().getName(), Font.BOLD, deploy.getFont().getSize()));
        deploy.setText("Deploy");
        bottomPanel.add(deploy);
        cancel = new JButton();
        cancel.setEnabled(true);
        cancel.setFont(new Font(cancel.getFont().getName(), Font.BOLD, cancel.getFont().getSize()));
        cancel.setText("Cancel");
        bottomPanel.add(cancel);
        final JPanel panel2 = new JPanel();
        panel2.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
        panel1.add(panel2, BorderLayout.WEST);
        loadPOM.setFont(new Font(loadPOM.getFont().getName(), Font.BOLD, loadPOM.getFont().getSize()));
        loadPOM.setHorizontalAlignment(0);
        loadPOM.setText("Load POM");
        panel2.add(loadPOM);
        cbDeployPOM = new JCheckBox();
        cbDeployPOM.setEnabled(true);
        cbDeployPOM.setText("");
        cbDeployPOM.setVisible(true);
        panel2.add(cbDeployPOM);
    }

    /**
     * @noinspection ALL
     */
    public JComponent $$$getRootComponent$$$() {
        return formPanel;
    }
}
